/*
 * Copyright 2008 CSC Consulting Group under the Apache License, 
 * Version 2.0 (the "License"); you may not use this file except in 
 * compliance with the License. You may obtain a copy of the License at 
 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable 
 * law or agreed to in writing, software distributed under the License is 
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
 * either express or implied. See the License for the specific language 
 * governing permissions and limitations under the License.
 */
package com.waw.calendar.plugin;

import com.jivesoftware.base.*;
import com.jivesoftware.community.*;
import com.jivesoftware.base.UserManager;
import com.jivesoftware.community.lifecycle.JiveApplication;
import com.jivesoftware.base.AuthFactory;

/**
 * PluginUtils provides a set of utility functions for the plugin.  
 * These include Clearspace manager retrieval functions.
 * 
 * @author Jim Tremlett
 */
public class PluginUtils {

   /**
   * Gets the community manager with system permissions.
   * 
   * @return The community manager.
   */  
   public static CommunityManager getCommunityManager()
   {	  
	  CommunityManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getCommunityManager(); 
	  return manager;	   
   }
   
   /**
    * Gets the blog manager with system permissions.
    * 
    * @return The blog manager.
    */  
public static BlogManager getBlogManager()
   {	  
	  BlogManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getBlogManager(); 
	  return manager;	   
   }

   /**
    * Gets the user manager with system permissions.
    * 
    * @return The user manager.
    */     
   public static UserManager getUserManager()
   {	  
	  UserManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getUserManager();
	  return manager;	   
   }  

   /**
    * Gets the presence manager with system permissions.
    * 
    * @return The presence manager.
    */   
   public static PresenceManager getPresenceManager()
   {	  
	  PresenceManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getPresenceManager(); 
	  return manager;	   
   }  
   
   /**
    * Gets the group  manager with system permissions.
    * 
    * @return The group manager.
    */   
   public static GroupManager getGroupManager()
   {	  
	  GroupManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getGroupManager(); 
	  return manager;	   
   } 

   /**
    * Gets the profile  manager with system permissions.
    * 
    * @return The profile   manager.
    */ 
   public static ProfileManager getProfileManager()
   {
		  ProfileManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getProfileManager(); 
		  return manager;	 
   }
   
   /**
    * Gets the profile field  manager with system permissions.
    * 
    * @return The profile field manager.
    */ 
   public static ProfileFieldManager getProfileFieldManager()
   {
		  ProfileFieldManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getProfileFieldManager(); 
		  return manager;	 
   }
   
   /**
    * Gets the avatar  manager with system permissions.
    * 
    * @return The avatar manager.
    */ 
   public static AvatarManager getAvatarManager()
   {
		  AvatarManager manager = JiveApplication.getContext(AuthFactory.getSystemAuthToken()).getAvatarManager(); 
		  return manager;	 
   }
}